package com.yao.system.websocket.config;

import com.yao.system.entity.dto.UserDTO;

import javax.servlet.http.HttpSession;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;



public class GetHttpSessionConfigurator extends ServerEndpointConfig.Configurator {


    /* 客户端第一次建立websocket连接时，会触发该方法 */
    @Override
    public void modifyHandshake(ServerEndpointConfig sec,
                                HandshakeRequest request,
                                HandshakeResponse response) {
        sec.getUserProperties().put("websocket_session", new UserDTO());
        System.out.println("66666666666666666666666666");
        //sec.getUserProperties().put(HttpSession.class.getName(), request.getHttpSession());
    }
}
